{include file="public/header" /}
<style>
    .layui-form-checkbox i{
        border-left: 1px solid #d2d2d2;
    }
    .hidden{
        display: none;
    }
</style>
<body class="gray-bg">
<div class="wrapper wrapper-content">
    <div class="ibox-content layui-form">
        <div class="layui-row layui-col-space10 layui-form-item ">
            <input type="hidden" name="tui_id" value="{$tui_id}">
            <input type="hidden" name="type" value="{$type}">
            <div class="layui-form-item layui-col-xs-offset1 layui-col-xs8">
                <label class="layui-form-label">{$type == 1 ? '换货' : '退货'}：</label>
                <div class="layui-input-block">
                    <input type="text" disabled class="layui-input " value="选中的为同意，不选的为拒绝">
                </div>
            </div>
            <!---->
            <div class="layui-form-item">
                <table class="layui-table">
                    <thead>
                    <tr>
                        <th>选择</th>
                        <th>商品名</th>
                        <th>规格</th>
                        <th>数量</th>
                        <th>价格</th>
                        <th>小计</th>
                    </tr>
                    </thead>
                    <tbody>
                    {volist name='details' id='vo'}
                    <tr>
                        <td>
                            <input type="checkbox" class="layui-input" name="fahuo[]" value="{$vo.tui_id}" />
                        </td>
                        <td>{$vo.good_name}</td>
                        <td>{$vo.goods_info}</td>
                        <td>{$vo.num}</td>
                        <td>{$vo.unit_price}</td>
                        <td>{$vo.unit_price * $vo.num}</td>
                    </tr>
                    {/volist}
                    </tbody>
                </table>
            </div>
            <!---->
            <div class="layui-form-item layui-col-xs-offset1 layui-col-xs8">
                <label class="layui-form-label">备注：</label>
                <div class="layui-input-block">
                    <input type="text" name="merchant_remark" placeholder="请输入备注" class="layui-input" value="">
                </div>
            </div>
            <div class="layui-form-item layui-col-xs-offset1 layui-col-xs8">
                <div class="layui-input-block">
                    <button class="layui-btn" lay-submit="" lay-filter="component-form-element">提交
                    </button>
                    <button class="layui-btn layui-btn-primary" onclick="wk.layer_close('close')">关闭</button>
                </div>
            </div>
        </div>
    </div>
</div>

{include file="public/footer" /}
<script>
    layui.use(['form'], function() {
        var form = layui.form;
        form.on('submit(component-form-element)', function (data) {
            if(confirm('确定吗？')){
                $('button').addClass('layui-disabled').attr('disabled','disabled');
                $.ajax({
                    url:"{:url('orderYesSend')}",
                    type:'post',
                    dataType:'json',
                    data:data.field,
                    success:function(res){
                        if (res.code == 200) {
                            layer.msg(res.msg,{icon:1,time:1500,shade:0.1},function(index){
                                wk.layer_close();
                            })
                        } else {
                            $("button").removeClass('layui-disabled').removeAttr('disabled');
                            wk.error(res.msg);
                            return false;
                        }
                    }
                })
            }

        });
    });
</script>
</body>
</html>